Skip to content

Add dict-based metadata pipeline for imaging #1677

Merged
h-mayorquin merged 13 commits intomainfrom
new_add_device_function
Mar 4, 2026
Merged

Add dict-based metadata pipeline for imaging #1677
h-mayorquin merged 13 commits intomainfrom
new_add_device_function

Conversation

@h-mayorquin
Copy link
Collaborator

@h-mayorquin h-mayorquin commented Mar 3, 2026

Related to #269

Implements the dict-based metadata pipeline for imaging extractors as discussed in #1653.

add_imaging_to_nwbfile now accepts the new dict-based metadata format keyed by metadata_key. When old metadata is passed, the data goes through an alternative path, effectively segregating new and old formats. This keeps the functions backwards compatible and the diff simpler. New helper functions (_add_imaging_plane_to_nwbfile, _add_photon_series_to_nwbfile, _add_device_to_nwbfile) handle the dict-based format, while old list-based functions are renamed with an _old_list_format suffix to handle the old one.

We introduce get_full_ophys_metadata() which provides a user-facing example template (moving forward with #1557). When users provide metadata with missing required fields, a clear ValueError is raised listing the missing fields and their placeholders. See also NeurodataWithoutBorders/nwb-schema#672 for some of the design rationale.

Closes #1653. Related: #1511, nwb-schema#672.

@h-mayorquin h-mayorquin marked this pull request as ready for review March 4, 2026 19:54
@h-mayorquin h-mayorquin requested a review from pauladkisson March 4, 2026 20:14
@h-mayorquin h-mayorquin changed the title Add dict-based metadata pipeline for imaging (roiextractors module) Add dict-based metadata pipeline for imaging Mar 4, 2026
@h-mayorquin h-mayorquin self-assigned this Mar 4, 2026
Copy link
Member

@pauladkisson pauladkisson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple nits, otherwise looks good.

@h-mayorquin h-mayorquin merged commit b630a43 into main Mar 4, 2026
24 checks passed
@h-mayorquin h-mayorquin deleted the new_add_device_function branch March 4, 2026 22:41
@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.08%. Comparing base (dac02a7) to head (55b27da).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/neuroconv/tools/roiextractors/roiextractors.py 88.23% 12 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1677      +/-   ##
==========================================
+ Coverage   81.01%   81.08%   +0.06%     
==========================================
  Files         160      160              
  Lines       12471    12574     +103     
==========================================
+ Hits        10104    10195      +91     
- Misses       2367     2379      +12     
Flag Coverage Δ
unittests 81.08% <88.88%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/neuroconv/tools/nwb_helpers/__init__.py 100.00% <ø> (ø)
...nv/tools/nwb_helpers/_metadata_and_file_helpers.py 91.81% <100.00%> (+0.29%) ⬆️
src/neuroconv/tools/roiextractors/roiextractors.py 77.04% <88.23%> (+1.86%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants